﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Common;

namespace my_project_energyzmem
{
    /// <summary>
    /// Логика взаимодействия для NewDocuments.xaml
    /// </summary>
    public partial class NewDocuments : Window
    {
        public List<Documentation> NewDocument {get; private set; }

        public NewDocuments()
        {
            InitializeComponent();
            NewDocument = new List<Documentation>();
        }
/// <summary>
/// 
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
        private void AddDocumentation_btn_Click(object sender, RoutedEventArgs e)
        {
            string name = Name_txbx.Text.Trim();
            string publisher = Publisher_txbx.Text.Trim();
            DateTime publisherDate = PublisherDate_dtp.DisplayDate;
            string isbn = ISBN_txbx.Text.Trim();
            string authorName = AuthorName_txbx.Text.Trim();
            DateTime date_1 = Date1_dtp.DisplayDate;
            DateTime date_2 = new DateTime(2014, 11, 2);
            string information = Information_txbx.Text.Trim();
            string accordocument = Accordocument_txbx.Text.Trim();
            string approved = Approved_txbx.Text.Trim();

            if (name != string.Empty && publisher != string.Empty && isbn != string.Empty && authorName != string.Empty && publisherDate != DateTime.MinValue && date_1 != DateTime.MinValue && date_2 != DateTime.MinValue && information != string.Empty && accordocument != string.Empty && approved != string.Empty)
            {
                NewDocument.Add(new Documentation(name, publisher, publisherDate, isbn, authorName,date_1, date_2, information, accordocument, approved));
            }
            MessageBox.Show("Не все поля указаны");
            return;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveDocumentation_btn_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }

    }
}
